#!/bin/bash
if [ -n "$2" ]
then
	do_date=$2
else
	#echo 必须给我传一个日期
	#exit
	do_date= $(date -d yesterday +%F) 
fi

echo 当前要操作的日期是$do_date

dws_interaction_sku_favor_add_1d="

"
dws_tool_user_coupon_coupon_used_1d="

"
dws_trade_province_order_1d="

"

dws_trade_user_cart_add_1d="

"
dws_trade_user_order_1d="

"

dws_trade_user_payment_1d="

"
dws_trade_user_sku_order_1d="

"

dws_traffic_page_visitor_page_view_1d="

"
dws_traffic_session_page_view_1d="

"


case $1 in
    "dws_trade_province_order_1d" )
        hive --database gmall -e "$dws_trade_province_order_1d"
    ;;
    "dws_trade_user_cart_add_1d" )
        hive --database gmall -e "$dws_trade_user_cart_add_1d"
    ;;
    "dws_trade_user_order_1d" )
        hive --database gmall -e "$dws_trade_user_order_1d"
    ;;
    "dws_trade_user_payment_1d" )
        hive --database gmall -e "$dws_trade_user_payment_1d"
    ;;
    "dws_trade_user_sku_order_1d" )
        hive --database gmall -e "$dws_trade_user_sku_order_1d"
    ;;
    "dws_tool_user_coupon_coupon_used_1d" )
        hive --database gmall -e "$dws_tool_user_coupon_coupon_used_1d"
    ;;
    "dws_interaction_sku_favor_add_1d" )
        hive --database gmall -e "$dws_interaction_sku_favor_add_1d"
    ;;
    "dws_traffic_page_visitor_page_view_1d" )
        hive --database gmall -e "$dws_traffic_page_visitor_page_view_1d"
    ;;
    "dws_traffic_session_page_view_1d" )
        hive --database gmall -e "$dws_traffic_session_page_view_1d"
    ;;
    "all" )
        hive --database gmall -e "$dws_trade_province_order_1d$dws_trade_user_cart_add_1d$dws_trade_user_order_1d$dws_trade_user_payment_1d$dws_trade_user_sku_order_1d$dws_tool_user_coupon_coupon_used_1d$dws_interaction_sku_favor_add_1d$dws_traffic_page_visitor_page_view_1d$dws_traffic_session_page_view_1d"
    ;;
esac

